# 主界面实现
from PySide2.QtWidgets import QMainWindow
from forms.uipy.UI_main import Ui_Main
from forms.uipyimpl.Ele_SituationImpl import Ele_SituationImpl
from forms.uipyimpl.ExcelFindUserImpl import ExcelFindUserImpl
from forms.uipyimpl.IndexFindImpl import IndexFindImpl
from forms.uipyimpl.LedgerImpl import LedgerImpl
from forms.uipyimpl.RationalUpCalImpl import RationalUpCalImpl
from forms.uipyimpl.HouseVisitRecordsImpl import HouseVisitRecordsForm
from forms.uipyimpl.ReportReviewImpl_收支 import ReportReviewImpl_收支
import subprocess



class MainWindowImpl(QMainWindow, Ui_Main):
    def __init__(self):
        super().__init__()
        self.setupUi(self)
        # **************************** 审核部分 ******************************* #
        # 绑定 审核   ==>  收支  ==>  体外(调用另外的程序)
        # self.sz_outer_auditor.triggered.connect(lambda: subprocess.Popen(
        #     r".\四川住户调查数据审核\四川住户调查数据审核.exe"))
        self.sz_outer_auditor.triggered.connect(lambda: subprocess.run(
            r".\四川住户调查数据审核\四川住户调查数据审核.exe"))
        # 绑定 审核   ===> 收支  ==>  自定义审核部分
        self.sz_auditor.triggered.connect(lambda: print("自定义收支审核点击"))
        # 绑定 审核   ===> 收支  ==>  报表审核部分
        self.sz_report_auditor.triggered.connect(lambda: self.setCentralWidget(ReportReviewImpl_收支()))

        # **************************** 汇总部分 ******************************* #

        # **************************** 可视化部分 ******************************* #
        ## 访户记录
        self.house_record.triggered.connect(lambda: self.setCentralWidget(HouseVisitRecordsForm()))
        # **************************** 工具部分 ******************************* #
        ## 电子记账汇总情况
        self.ele_situation.triggered.connect(lambda: self.setCentralWidget(Ele_SituationImpl()))
        ## Excel查找用户
        self.excel_find_user.triggered.connect(lambda: self.setCentralWidget(ExcelFindUserImpl()))
        ## 指标查找
        self.index_find.triggered.connect(lambda: self.setCentralWidget(IndexFindImpl()))
        ## 合理性和增长性数据（采集）
        self.rational_up_cal.triggered.connect(lambda: self.setCentralWidget(RationalUpCalImpl()))
        ## 台账
        self.ledger.triggered.connect(lambda: self.setCentralWidget(LedgerImpl()))
